# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>

# i.MX driver for Xorg
buildarch=4

pkgname="xf86-video-imx"
srcname="xserver-xorg-video-imx"
pkgver=11.09.01
pkgrel=3
arch=('armv7h')
url="http://www.freescale.com"
license=('GPL2')
depends=('libz160')
makedepends=('pkgconfig' 'xorg-server-devel' 'resourceproto' 'scrnsaverproto' 'linux-headers-imx6-fsl')
options=('!libtool')
source=("http://archlinuxarm.org/builder/src/xserver-xorg-video-imx-${pkgver}.tar.gz"
        'xserver-1.14-compat.patch'
        'Fix-error-unknown-type-name-uint.patch'
        'Make-video-API-forward-and-backward-compatible.patch'
        'ext-Update-to-newer-swap-macros.patch'
        'xf86-video-imxfb-fix-m4-hardcodded-paths.patch'
        'xserver-1.17-compat.patch')
md5sums=('d19148399b5d1c4dab90d0cc6f2c4789'
         '2599833ffb69482ed2fae1c6bbfe0b3e'
         '02db4718380ed7073ea573725256b5d2'
         'c4ddcff1f2d465eaccb64a14288510e2'
         'f3ee43174a3a90e7a25dd5b9422caf34'
         'aa92032c374f77845ad35f35db6dd231'
         'b3ee8ded808cc16e9404ee45bba5438a')

prepare() {
  cd "${srcdir}/${srcname}-${pkgver}"

  patch -p1 -i ../xserver-1.14-compat.patch
  patch -p1 -i ../Fix-error-unknown-type-name-uint.patch
  patch -p1 -i ../Make-video-API-forward-and-backward-compatible.patch
  patch -p1 -i ../ext-Update-to-newer-swap-macros.patch
  patch -p1 -i ../xf86-video-imxfb-fix-m4-hardcodded-paths.patch
  patch -p1 -i ../xserver-1.17-compat.patch
}

build() {
  cd "${srcdir}/${srcname}-${pkgver}"

  ./configure --prefix=/usr

  make
}

package() {
  pkgdesc="i.MX driver for Xorg"

  cd "${srcdir}/${srcname}-${pkgver}"

  make DESTDIR="${pkgdir}" install
}
